package com.example.wanandroid_copy2.ui.collect.data.repository

import androidx.lifecycle.MutableLiveData
import com.example.wanandroid_copy2.common.BaseObserver
import com.example.wanandroid_copy2.common.BaseResponse
import com.example.wanandroid_copy2.common.api.ApiRepository
import com.example.wanandroid_copy2.common.network.State
import com.example.wanandroid_copy2.common.utils.execute
import com.example.wanandroid_copy2.ui.article.data.ArticleRepository
import com.example.wanandroid_copy2.ui.collect.data.model.CollectRsp

/**
 * @author Laizexin on 2019/12/5
 * @description
 */
class CollectRepository(loadState: MutableLiveData<State>) : ArticleRepository(loadState) {

    fun getCollectArticles(page : Int, liveData: MutableLiveData<BaseResponse<CollectRsp>>){
        apiService.getCollectArticle(page).execute(BaseObserver(liveData, loadState,this))
    }

    fun unCollect(id: Int, originId: Int, liveData: MutableLiveData<BaseResponse<Any>>){
        apiService.unMyCollect(id,originId).execute(BaseObserver(liveData, loadState,this))
    }

}